﻿// Module:             Games Programming
// Assignment1:        Platformer Game
// Add game feature:   Spikes Trap
// Student Number:     S10095741D
// Student Name:       Ng Cheong Sian

//////////////////////////////////////////////////////////////////////////

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Game.TrapScripts
{
    class Spikes:ITrap
    {
        private Texture2D _texture;
        private Vector2 _position;
        private Rectangle _rect;

        public Spikes(Texture2D texture, int x, int y)
        {
            _texture = texture;
            _position = new Vector2(x * Game1.GridSize, y * Game1.GridSize - texture.Height);

            _rect = new Rectangle((int) _position.X, (int) _position.Y, texture.Width, texture.Height);
        }

        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(_texture, _position, Color.White);
        }

        public void Update(GameTime gameTime)
        {
            // do nothing
        }

        public Rectangle GetBoundingRect()
        {
            return _rect;
        }

        public bool IsActive { get { return true; } }
        public TrapType Type { get {return TrapType.Spikes;} }
// active all the time.
    }
}
